package com.luyuan.crm.test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class FileReader {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                FileReader.class.getResourceAsStream("province.text"), "UTF-8"));

        String[] code = new String[3];

        int i = 0;

        String tempString = null;
        // 一次读入一行，直到读入null为文件结束
        while ((tempString = reader.readLine()) != null) {
            // 显示行号
            code[i++] = tempString;

            if (i % 3 == 0) {
                i = 0;

                System.out.println("update lyt_region set provincial_capital = '" + code[2] + "' where province like '"
                        + code[0] + "%';");
            }
        }
        reader.close();
    }
}
